As mentioned above, you can choose to enter an error REP loop whenever an error is signalled. This error may have been signalled internally by Scheme, or it may have been signalled by an error statement that you inserted in the program yourself. Loops of a slightly different flavor can be entered via the bkpt special form or by typing a B at the keyboard.
The Scheme breakpoint facility allows you to pause execution of a program in midstream, whereupon you can examine and modify the values of local variables, among other things. When you pause execution and enter a breakpoint, Scheme runs a REP loop just as it normally does—you type expressions and the interpreter evaluates them and prints their value. The difference is that the environment in which these expressions are evaluated is not the global environment, but rather the environment from which the breakpoint was entered.
Breakpoints can be entered in the following ways:
To continue from a breakpoint, evaluate the expression (proceed). The interpreter will continue as though the breakpoint had not occurred. If the REP loop was entered because of a bkpt or error special form, evaluating (proceed expression) will evaluate the expression and return that value for the value of the special form.
If the REP loop was entered because of a break-entry or break-exit, (proceed expression) will evaluate expression and return that value in place of the value which would be calculated by the ``broken'' procedure. This is convenient if you realize that a procedure is calculating the wrong answer. You may want to quickly try out the rest of your program as though this procedure really worked. You can break-entry the questionable procedure, and then use (proceed expression) to simulate the way the procedure should work.
Instead of continuing the program by using proceed, you can type G which aborts execution and returns to the top-level REP loop. This is frequently done after ``snooping around'' to discover the problem: type G and try again. Similarly, U halts execution and returns to the preceding (lower level number) REP loop. X resumes the current REP loop. This is useful, for example, when you ask Scheme to pretty-print a long procedure and want to stop it in the middle of the printing and get back to the current REP loop prompt.
For REP loops caused by errors in Scheme primitives, evaluating (proceed) will simply call the primitive again. This is rarely what you want to do. You should investigate the problem, fix the program, and try it all over again.